import { defineConfig } from '@umijs/max';
import routers from './routers/index';

const { UMI_ENV } = process.env; // 上下文资源
const historyType: any = {
  ylb: 'browser',
  prod: 'browser',
};
export default defineConfig({
  hash: true,
  antd: {},
  title: '即时通讯IM前端开发平台',
  request: {},
  initialState: {},
  history: {
    type: 'browser',
  },
  targets: {
    chrome: 84,
  },
  dva: {},
  model: {},
  locale: {
    default: 'zh-CN',
    baseSeparator: '-',
  },
  layout: {
    locale: false,
    siderWidth: 200
  },
  outputPath: `dist/volc-engine-im-dist`,
  valtio: {},
  define: {
    UMI_ENV: UMI_ENV || '',
  },
  routes: routers,
  // 开启权限配置
  access: {},
  theme: {
    'root-entry-name': 'variable',
    'disabled-color': '#202d40',
    'menu-dark-bg': 'red', // 设置menu的背景颜色
  },
  headScripts: [
    {
      type: 'text/javascript',
      src: `https://dev.theling.team/comm/theling-def.js?v=${new Date().getTime()}`,
    },
    {
      type: 'text/javascript',
      src: `/icon/qyfw_icon.js?v=${new Date().getTime()}`,
    },
    {
      type: 'text/javascript',
      src: `/icon/jyfw_icon.js?v=${new Date().getTime()}`,
    },
  ],
  styles: ['body { margin: 0; }'],
  links: [
    {
      rel: 'icon',
      href: 'http://www.deerpu.cn/demo/file/logo.png',
      type: 'image/x-icon',
    },
  ],
  ignoreMomentLocale: true,
  manifest: {
    basePath: '/',
  },
  fastRefresh: true,
  presets: ['umi-presets-pro'],
  codeSplitting: {
    jsStrategy: 'bigVendors',
  }
})
